package com.whfc.wxmp.api.sys.service.impl;

import com.whfc.fuum.dto.WxInviteCodeDTO;
import com.whfc.fuum.dto.WxInviteDTO;
import com.whfc.fuum.entity.WxUser;
import com.whfc.fuum.param.WxInviteUserJoinParam;
import com.whfc.fuum.service.AppInviteService;
import com.whfc.wxmp.api.sys.service.WxInviteService;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.stereotype.Service;

/**
 * 用户邀请
 *
 * @author guodong_sun
 * @Description:
 * @date 2019年11月11日
 */
@Service
public class WxInviteServiceImpl implements WxInviteService {

    @DubboReference(interfaceClass = AppInviteService.class, version = "1.0.0")
    private AppInviteService appInviteService;


    @Override
    public WxInviteCodeDTO getCode(WxUser user, Integer deptId) {
        String phone = user.getPhone();
        return appInviteService.getCode(phone, deptId);
    }

    @Override
    public WxInviteDTO getInviteInfo(String phone, String code) {
        return appInviteService.getInviteInfo(phone, code);
    }

    @Override
    public void inviteUserJoin(WxUser user, WxInviteUserJoinParam request) {
        String phone = user.getPhone();
        String nickName = user.getNickName();
        appInviteService.inviteUserJoin(phone, nickName, request);
    }

}
